<?PHP
class Trace
{
	static $inst;
	
	static function Create($className = "TraceContext")
	{
		if ( empty(Trace::$inst) )
		{
			if ( class_exists($className) )
			{
				Trace::$inst = new $className();
			}
			else
			{
				Trace::$inst = new TraceContext();
			}
		}
		
		return Trace::$inst;
	}
	
	static function Write()
	{
		$trace = self::Create();
		
		$trace->Write($message);
	}
}

class TraceContext
{
	private $data = array();
	
	public function Write($message)
	{
		$this->data[] = $message;
	}
	
	public function ToFile()
	{
		return $this->data;
	}
}
?>